<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMemberCoinBillsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_coin_bills', function (Blueprint $table) {
            $table->id();
            $table->integer('member_id')->default(0)->comment('会员ID');
            $table->tinyInteger('action')->default(0)->comment('操作');
            $table->tinyInteger('type')->default(0)->comment('收支方向');
            $table->integer('before_amount')->default(0)->comment('变动前数量');
            $table->integer('amount')->default(0)->comment('变动数量');
            $table->integer('after_amount')->default(0)->comment('变动后数量');
            $table->string('desc', 256)->default('')->comment('描述');
            $table->string('token', 32)->default('')->comment('票据 检测数据是否安全用');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `member_coin_bills` comment '会员金币流水表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('member_coin_bills');
    }
}
